package cn.kgm.controller;

import cn.kgm.entity.MyBatis;
import cn.kgm.service.MyBatisService;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2023-6-28 14:30
 * @Description: cn.kgm.controller.MyBatisController
 */
@RestController
@RequestMapping("/mybatis")
public class MyBatisController {

    @Autowired
    private MyBatisService myBatisService;

    @GetMapping("/{id}")
    public String getMyBatis(@PathVariable("id") Long id) {
        MyBatis batis = myBatisService.getOne(id);
        return JSON.toJSONString(batis);
    }
}
